www.gusucode.com > LTE基带收发仿真系统matlab源码程序 > LTE baseband simulation/gen_channel.m
function [Hcell h] = gen_channel(nTx,nRx,FFT_SIZE,channelFreq,channelMod,carrBand) % 功能:信道相应生成函数 % 输入: % nTx:发送天线数 % nRx:接收天线数 % FFT_SIZE:FFT变换点数 % channelFreq:频域信道标记 % channelMod:信道模型 % carrBand:每个载波带宽 % 输出: % Hcell:频域信道输出 % h:时域信道输出 % % Author: 程式小组(徐萌 张妙 张晓庆) % Date: 2010-07-11 % ========================================================== if channelFreq ==true % 产生频域信道 h = 1; % 频域信道下,该参数不使用 Hcell = cell(FFT_SIZE,1); % 产生中心子载波上的频域信道矩阵{nRx,nTx} tempH = 1/sqrt(2)*(randn(nRx,nTx)+1i*randn(nRx,nTx)); % 对信道增益归一化 for iRx = 1:nRx normH = norm(tempH(iRx,:)); tempH(iRx,:) = tempH(iRx,:)./normH; end % 为其他子载波产生相移 half = FFT_SIZE/2; for k = 1:FFT_SIZE Hcell{k} = zeros(nRx,nTx); if k <= half Hcell{k} = tempH.*exp(-1i*2*pi*(half-k+1)/FFT_SIZE); else Hcell{k} = tempH.*exp(1i*2*pi*(k-half-1)/FFT_SIZE); end end else % 产生时域信道 Hcell = cell(1); % 时域信道下,该参数不使用 if strcmp(channelMod,'PedA') % ITU Pedestrian A PDP_dB = [0 -9.7 -19.2 -22.8]; % Average power [dB] delay = [0 110e-9 190e-9 410e-9]; % Relative delay (ns) elseif strcmp(channelMod,'PedB') % ITU Pedestrian B PDP_dB = [0 -.9 -4.9 -8.0 -7.8 -23.9]; % Average power [dB] delay = [0 200e-9 800e-9 1200e-9 2300e-9 3700e-9]; % Relative delay (ns) elseif strcmp(channelMod,'VehA') % ITU Vehicular A PDP_dB = [0 -1 -9 -10 -15 -20]; % Average power [dB] delay = [0 310e-9 710e-9 1090e-9 1730e-9 2510e-9]; % Relative delay (ns) elseif strcmp(channelMod,'VehB') % ITU Vehicular B PDP_dB = [-2.5 0 -12.8 -10.0 -25.2 -16.0]; % Average power [dB] delay = [0 300e-9 8900e-9 12900e-9 17100e-9 20000e-9]; % Relative delay (ns) elseif strcmp(channelMod,'Ideal') % 理想信道 PDP_dB = 0; % Average power [dB] delay = 0; % Relative delay (ns) end nPath = length(delay); power = 10.^(PDP_dB./10); % 功率的真值表示 power = power/sum(power); % 功率归一化 delay = round(delay.*carrBand.*FFT_SIZE)+1; % 时延量化 maxDelay = max(delay); % 最大时延量化值 h = zeros(nRx,nTx,maxDelay); if strcmp(channelMod,'Ideal') % 理想信道下 产生单位矩阵 h = eye(nRx,nTx); else for iRx = 1:nRx for iTx = 1:nTx for iPath = 1:nPath a = 1/sqrt(2)*(randn+1i*randn); a = a/abs(a); h(iRx,iTx,delay(iPath)) = a*sqrt(power(iPath)); end end end end end